import { getCateoryDetails } from "@/api/category";
import CategoryForm from "@/components/CategoryForm";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";

export default function CategoryEdit() {
    const router = useRouter();
    const [editData, setData] = useState({});
    useEffect(() => {
        const fetchData = async () => {
            const { id } = router.query;
            if (id) {
                const res = await getCateoryDetails(id as any);
                setData(res.data);
            }
        }
        fetchData();
    }, [router])
    return <CategoryForm title={"分类编辑"} editData={editData} />
}
